Draft
Conversation
iamnovichek
requested changes
Nov 20, 2024
tracker/tasks.py
Outdated
|
|
||
|
|
||
| @app.on_after_configure.connect | ||
| def check_for_new_issues(sender, **kwargs): |
Collaborator
There was a problem hiding this comment.
add types annotation, docstrings
tracker/tasks.py
Outdated
| print(arg) | ||
|
|
||
|
|
||
| def get_relevant_recipients(repositories: list) -> dict[str, list]: |
tracker/tasks.py
Outdated
| subscribed_users = TelegramUser.objects.filter( | ||
| notify_about_new_issues=True, | ||
| user__repository__name__in=repositories # Assuming 'name' identifies the repositories. | ||
| ).distinct() |
Collaborator
There was a problem hiding this comment.
We do not need distinct here
tracker/tasks.py
Outdated
| user_repo_map = {} | ||
|
|
||
| for telegram_user in subscribed_users: | ||
| repositories = Repository.objects.filter(user=telegram_user.user, name__in=repositories) |
Collaborator
There was a problem hiding this comment.
Did you test it? It guess it's gonna shadow the param repositories in this function
tracker/tasks.py
Outdated
| for telegram_user in subscribed_users: | ||
| repositories = Repository.objects.filter(user=telegram_user.user, name__in=repositories) | ||
|
|
||
| print(f"Telegram User: {telegram_user.telegram_id}") |
tracker/telegram/bot.py
Outdated
| @dp.message(Command("notify_about_new_issues")) | ||
| async def subscribe_to_issue_notifications(msg: Message): | ||
| try: | ||
| telegram_user = TelegramUser.objects.get(telegram_id=msg.from_user.id) |
Collaborator
There was a problem hiding this comment.
Use filter(...).first() instead of get. That way you won't get an exception. Just None if it doesn't exist
djeck1432
requested changes
Nov 20, 2024
djeck1432
reviewed
Nov 21, 2024
core/settings.py
Outdated
|
|
||
| # SECURITY WARNING: don't run with debug turned on in production! | ||
| DEBUG = False | ||
| DEBUG = True |
Collaborator
There was a problem hiding this comment.
move it to env file, don't forget to add it to env.example
djeck1432
requested changes
Nov 21, 2024
|
|
||
|
|
||
| @dp.message(Command("notify_about_new_issues")) | ||
| async def subscribe_to_issue_notifications(msg: Message): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.